CreateBlockDevicesWithCygwin
How to create another partition or actually, another colinux block_device ? <Gniarf> this page is old. <quaestor>...but still useful, particularly with an update ;-). Man, that's what I get for editing wiki before coffee. I didn't even notice that this was for using Cygwin :-( XP Pro (may also apply to Home; I don't know) includes a number of new command line tools, among them fsutil: fsutil file createnew kubuntu.ext3 2147483648 creates a 2 Gig file called kubuntu.ext3 in the current directory. (In all honesty, I found out about fsutil from the FAQ Q28) To create a sparse file: fsutil file createnew 2147483648 fsutil sparse setflag fsutil sparse setrange 0 2147483648 This creates a file on disk which initially takes up only 4,096 bytes and will grow to an upper limit of 2 G as it fills (perfect for disk images). The file created above can be passed in to coLinux as usual, and formatted from within a running Linux instance using, for example, "mkfs.ext3 /dev/cobd2". Then you can mount and copy as described below. <Gniarf> continues... * the first part is about creating so-called filesystems formatted in ext3fs, usually from Cygwin. most people will directly download such files from the given URL * the second part is short and oriented on how to use them, like moving data with cp -ax (you can use it to expand your Debian 1Gb image file to a 2Gb image file just by copying everything from one partition to the other with cp -ax. you can also mount /usr, /home, /var on a separate partition since they will get BIG, especially on the Gentoo image) ---- first you may need to create more block devices like /dev/cobd3 , 4... and more with commands like mknod /dev/cobd3 b 117 3 mknod /dev/cobd4 b 117 4 Sometimes a script is very useful: #/bin/sh for i in 1 2 3 4 5 6 7 8 9 do mknod /dev/cobd$i b 117 $i done ---- <Gniarf> You can shutdown coLinux, copy your root_fs to borg_root_fs, add a line to default.colinux.xml : and a line to your /etc/fstab file : /dev/cobd2 /mnt ext3 defaults 0 0 then go to /mnt and treat yourself with a rm -rf . Now if you want a partition with a different size, you would have to download the e2fsprogs package from http://e2fsprogs.sourceforge.net/ , compile it (Cygwin worked for me with ./configure --disable-nls), create a file image and format it : create a 512 Mo file : $ dd if=/dev/zero of=borg_root_fs bs=1024k count=512 * 512+0 records in * 512+0 records out format it to ext2fs : $ mke2fs.exe borg_root_fs * mke2fs 1.35 (28-Feb-2004) * borg_root_fs is not a block special device. * Proceed anyway? (y,n) y * (lots of stuff...) * Writing inode tables: done * Writing superblocks and filesystem accounting information: done * This filesystem will be automatically checked every 24 mounts or * 180 days, whichever comes first. Use tune2fs -c or -i to override. convert it to ext3fs : $ tune2fs.exe -j borg_root_fs * tune2fs 1.35 (28-Feb-2004) * Creating journal inode: done * This filesystem will be automatically checked every 24 mounts or * 180 days, whichever comes first. Use tune2fs -c or -i to override. next, edit your default.colinux.xml and /etc/fstab as previously mentionned and everything should be ok. ---- <Gniarf> now, you can avoid all this pain and download some here : * http://gniarf.nerim.net/colinux/fs preformatted images of various size, from 128 Mb to 4 Gb, all suitable with Windows running on FAT32 and NTFS. there is even a quite larger 10 Gb image for users under NTFS only. ---- <ArKay> Of course--if you are too lazy to fiddle with GCC in cygwin--you can also * use dd in cygwin as mentioned * add the new partition file to your default.colinux.xml * boot your linux system and use mke2fs and tune2fs on the created partiton file (for instance /dev/cobd2) mke2fs -j /dev/cobd2 tune2fs -j /dev/cobd2 * copy over the files from your old partition or mount the new one to your liking ;) ---- <Gniarf> do you confirm you can use mke2fs and tune2fs from within colinux to access external partition files ? I remember I tried and couldn't get it to work, which is why I created this page and some pre-made files. ---- <ArKay> It worked fine for me out of the box. All I really did was to create the new file with dd, add it to the default.colinux.xml, run mk2fs on the unmounted /dev/cobd followed by tune2fs. Afterwards I was able to mount the new partition and copy over all of the files. ---- mke2fs worked for me with the gentoo image, but mkreiserfs didn't work ---- <Gniarf> ok, how do I actually copy everything from one partition to the other with cp -ax ? the idea is to mount your older linux image in /mnt and your new image in /mnt2, then cp -ax /mnt/* /mnt2 so first you have to get a destination image like the ones here. and since you will use your current linux image as the source image, you want another linux image to boot colinux and mount your source and destination images. so, either use a spare linux image, or just duplicate it (copy the file under windows, with coLinux not running, of course). oh, usually your /etc/fstab will not be set to use /mnt or /mnt2, so mount them with lines like : mount /dev/cobd3 /mnt2 also, you will get a message about lost+found being skipped. you can discard it. ---- A quick tip for doing all this: * Turn off colinux * Copy your root fs to a new file * In windows, use python to add a lot of space at the end of your new rootfs using win32file.SetFilePointer to move the pointer to way past the end of the file: >>> f=win32file.~CreateFile("Debian-3.0r2.ext3-mit-backports.1gb",win32con.GENERIC_WRITE, 0,None,win32con.OPEN_EXISTING, 0,0) >>> f >>> win32file.~SetFilePointer(f, 1024*1024*1024*4,win32con.FILE_END) 5915017217L >>> win32file.~SetEndOfFile(f) 1 >>> win32file.~CloseHandle(f) >>> ^Z Then: * Update xml so colinux gets also the new device * In colinux (debian) apt-get install ext2resize * Use ext2resize to resize the new root partition to the new size (this takes a while...try using verbose i didn't) * Update xml so colinux uses the new instead of the old as root fs ---- ----MassTranslated on 25 Dec 2004. ----MassTranslated on Sun Apr 23 17:35:57 UTC 2006 ----ManuallyAdjusted on 20 July 2008